//
//  RoundCornerCell.swift
//  XingCeHelper
//
//  Created by 申铭 on 2022/11/9.
//

import UIKit
import SnapKit

class RoundCornerCell: BaseTableViewCell {
    
    var rectCorner: UIRectCorner = []

    override func awakeFromNib() {
        super.awakeFromNib()
        
        separatorInset = UIEdgeInsets(top: 0, left: kCellSeparatorInsetLeft, bottom: 0, right: 0)
    }
    
    // 控制左右边缘的距离
    override var frame: CGRect {
        didSet {
//            let margin: CGFloat = 12
//            var newFrame = frame
//            newFrame.origin.x += margin
//            newFrame.size.width -= (margin * 2)
//            super.frame = newFrame
        }
    }
    
    // 横竖屏适配
    override func layoutSubviews() {
        super.layoutSubviews()
        
        let shapeLayer = CAShapeLayer()
        let cornerRadius:CGFloat = 15
        let bezierPath = UIBezierPath(roundedRect: bounds, byRoundingCorners: rectCorner, cornerRadii: CGSize(width: cornerRadius,height: cornerRadius))
        shapeLayer.path = bezierPath.cgPath
        layer.mask = shapeLayer
    }

}
